package com.eshop.enums;

import java.util.stream.Stream;

public enum OrderCountEnum
{
    TODAY(Integer.valueOf(1), "今天"), 
    YESTERDAY(Integer.valueOf(2), "昨天"), 
    WEEK(Integer.valueOf(3), "上周"), 
    MONTH(Integer.valueOf(4), "本月");
    
    private Integer value;
    private String desc;
    
    public static OrderCountEnum toType(final int value) {
        return Stream.of(values()).filter(p -> p.value == value).findAny().orElse(null);
    }
    
    public Integer getValue() {
        return this.value;
    }
    
    public String getDesc() {
        return this.desc;
    }
    
    private OrderCountEnum(final Integer value, final String desc) {
        this.value = value;
        this.desc = desc;
    }
}
